﻿using System;
using System.Runtime.InteropServices;

namespace Vtron.LEDCorrective.Domain.LEDSender
{
    /// <summary>
    /// SCP协议主体
    /// </summary>
    /// <remarks>
    //  协议主体
    //  struct _scp_body_t
    //  {
    //      u_int16_t			scp_subtype;	/*对应EnumScpSubtype*/
    //      u_int32_t			scp_datalen;
    //      int8_t			scp_data[0];
    //  }PACKED;
    /// </remarks>
    [Serializable]
    [StructLayout(LayoutKind.Sequential, Pack = 1)]
    public struct SCP_BODY_T
    {
        /// <summary>
        /// 类型
        /// </summary>
        public UInt16 scp_subtype;

        /// <summary>
        /// 状态位
        /// </summary>
        public UInt32 scp_status;

        /// <summary>
        /// 数据长度
        /// </summary>
        public UInt32 scp_datalen;

        /// <summary>
        /// 数据
        /// </summary>
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 200)]
        public byte[] scp_data;
    }

    [Serializable]
    [StructLayout(LayoutKind.Sequential, Pack = 1)]
    public struct SCP_BODY_T3
    {
        /// <summary>
        /// 类型
        /// </summary>
        public UInt16 scp_subtype;

        /// <summary>
        /// 状态位
        /// </summary>
        public UInt32 scp_status;

        /// <summary>
        /// 数据长度
        /// </summary>
        public UInt32 scp_datalen;

        /// <summary>
        /// 数据
        /// </summary>
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 664384)]
        public byte[] scp_data;
    }

    [Serializable]
    [StructLayout(LayoutKind.Sequential, Pack = 1)]
    public struct SCP_HEADER_T3
    {
        /// <summary>
        /// 会话ID
        /// </summary>
        public UInt32 scp_id;

        /// <summary>
        /// 类型
        /// </summary>
        public UInt16 scp_type;

        /// <summary>
        /// 数据长度
        /// </summary>
        public UInt32 scp_datalen;

        /// <summary>
        /// 数据
        /// </summary>
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 664394)]
        public byte[] scp_data;
    }


    [Serializable]
    [StructLayout(LayoutKind.Sequential, Pack = 1)]
    public struct SCP_BODY_T2
    {
        /// <summary>
        /// 类型
        /// </summary>
        public UInt16 scp_subtype;

        /// <summary>
        /// 状态位
        /// </summary>
        public UInt32 scp_status;

        /// <summary>
        /// 数据长度
        /// </summary>
        public UInt32 scp_datalen;

        /// <summary>
        /// 数据
        /// </summary>
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 42)]
        public byte[] scp_data;
    }

    [Serializable]
    [StructLayout(LayoutKind.Sequential, Pack = 1)]
    public struct SCP_HEADER_T2
    {
        /// <summary>
        /// 会话ID
        /// </summary>
        public UInt32 scp_id;

        /// <summary>
        /// 类型
        /// </summary>
        public UInt16 scp_type;

        /// <summary>
        /// 数据长度
        /// </summary>
        public UInt32 scp_datalen;

        /// <summary>
        /// 数据
        /// </summary>
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 52)]
        public byte[] scp_data;
    }

    [Serializable]
    [StructLayout(LayoutKind.Sequential, Pack = 1)]
    public struct SCP_BODY_T4
    {
        /// <summary>
        /// 类型
        /// </summary>
        public UInt16 scp_subtype;

        /// <summary>
        /// 状态位
        /// </summary>
        public UInt32 scp_status;

        /// <summary>
        /// 数据长度
        /// </summary>
        public UInt32 scp_datalen;

        /// <summary>
        /// 数据
        /// </summary>
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
        public byte[] scp_data;
    }

    [Serializable]
    [StructLayout(LayoutKind.Sequential, Pack = 1)]
    public struct SCP_HEADER_T4
    {
        /// <summary>
        /// 会话ID
        /// </summary>
        public UInt32 scp_id;

        /// <summary>
        /// 类型
        /// </summary>
        public UInt16 scp_type;

        /// <summary>
        /// 数据长度
        /// </summary>
        public UInt32 scp_datalen;

        /// <summary>
        /// 数据
        /// </summary>
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 14)]
        public byte[] scp_data;
    }

    [Serializable]
    [StructLayout(LayoutKind.Sequential, Pack = 1)]
    public struct SCP_BODY_T8
    {
        /// <summary>
        /// 类型
        /// </summary>
        public UInt16 scp_subtype;

        /// <summary>
        /// 状态位
        /// </summary>
        public UInt32 scp_status;

        /// <summary>
        /// 数据长度
        /// </summary>
        public UInt32 scp_datalen;

        /// <summary>
        /// 数据
        /// </summary>
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 48)]
        public byte[] scp_data;
    }

    [Serializable]
    [StructLayout(LayoutKind.Sequential, Pack = 1)]
    public struct SCP_HEADER_T8
    {
        /// <summary>
        /// 会话ID
        /// </summary>
        public UInt32 scp_id;

        /// <summary>
        /// 类型
        /// </summary>
        public UInt16 scp_type;

        /// <summary>
        /// 数据长度
        /// </summary>
        public UInt32 scp_datalen;

        /// <summary>
        /// 数据
        /// </summary>
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 58)]
        public byte[] scp_data;
    }


    [Serializable]
    [StructLayout(LayoutKind.Sequential, Pack = 1)]
    public struct SCP_BODY_T44
    {
        /// <summary>
        /// 类型
        /// </summary>
        public UInt16 scp_subtype;

        /// <summary>
        /// 状态位
        /// </summary>
        public UInt32 scp_status;

        /// <summary>
        /// 数据长度
        /// </summary>
        public UInt32 scp_datalen;

        /// <summary>
        /// 数据
        /// </summary>
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 44)]
        public byte[] scp_data;
    }

    [Serializable]
    [StructLayout(LayoutKind.Sequential, Pack = 1)]
    public struct SCP_HEADER_T44
    {
        /// <summary>
        /// 会话ID
        /// </summary>
        public UInt32 scp_id;

        /// <summary>
        /// 类型
        /// </summary>
        public UInt16 scp_type;

        /// <summary>
        /// 数据长度
        /// </summary>
        public UInt32 scp_datalen;

        /// <summary>
        /// 数据
        /// </summary>
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 54)]
        public byte[] scp_data;
    }


    [Serializable]
    [StructLayout(LayoutKind.Sequential, Pack = 1)]
    public struct SCP_BODY_T80
    {
        /// <summary>
        /// 类型
        /// </summary>
        public UInt16 scp_subtype;

        /// <summary>
        /// 状态位
        /// </summary>
        public UInt32 scp_status;

        /// <summary>
        /// 数据长度
        /// </summary>
        public UInt32 scp_datalen;

        /// <summary>
        /// 数据
        /// </summary>
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 80)]
        public byte[] scp_data;
    }

    [Serializable]
    [StructLayout(LayoutKind.Sequential, Pack = 1)]
    public struct SCP_HEADER_T80
    {
        /// <summary>
        /// 会话ID
        /// </summary>
        public UInt32 scp_id;

        /// <summary>
        /// 类型
        /// </summary>
        public UInt16 scp_type;

        /// <summary>
        /// 数据长度
        /// </summary>
        public UInt32 scp_datalen;

        /// <summary>
        /// 数据
        /// </summary>
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 90)]
        public byte[] scp_data;
    }
}
